package com.tenglong.teacher.ui.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.tenglong.teacher.R;
import com.tenglong.teacher.data.requestInfo.WorkPaperMistakesInfo;
import com.tenglong.teacher.ui.adapter.viewholder.WorkPaperViewHolder;
import com.tenglong.teacher.ui.adapter.viewholder.base.BaseViewHolder;

import java.util.List;


/**
 * @author hdx on 2019/3/25.
 */
public class WorkPaperAdapter extends RecyclerView.Adapter<BaseViewHolder<WorkPaperMistakesInfo>> {

    private List<WorkPaperMistakesInfo> infos;

    public WorkPaperAdapter(List<WorkPaperMistakesInfo> infos) {
        this.infos = infos;
    }

    @NonNull
    @Override
    public BaseViewHolder<WorkPaperMistakesInfo> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new WorkPaperViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_work_pager, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder<WorkPaperMistakesInfo> holder, int position) {
        holder.setLayoutInfo(infos.get(position));
    }

    @Override
    public int getItemCount() {
        return infos.size();
    }
}
